<%@ page language="java" import="java.util.*,java.sql.*,java.lang.*,student.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'checkAdd.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

  </head>
  
  <body>
    <%
    request.setCharacterEncoding("UTF-8");
String name = request.getParameter("name");
String sex = request.getParameter("sex");

String tel = request.getParameter("tel");
String qq = request.getParameter("qq");

String wechat = request.getParameter("wechat");
String[] gradeid = request.getParameterValues("gradeid");
int gid=Integer.parseInt(gradeid[0]);

String enterdate = request.getParameter("enterdate");
String fromcity= request.getParameter("fromcity");

String bir = request.getParameter("bir");
String add = request.getParameter("address");
String pass= request.getParameter("pass");
Student ss=new Student(0,name,sex,tel,qq,wechat,gid,
enterdate,fromcity,bir,add,pass);

MySqlStudentDaoImpl dao=new MySqlStudentDaoImpl();

int i=dao.add(ss);
if(i>0){
response.sendRedirect("success.jsp");

}else{
response.sendRedirect("addStu2.jsp");

}


    
    
    
    
    
     %>
  </body>
</html>
